package jdom;
import org.jdom.Element;

public class Developer {

	private String id;
	private String name;
	private String website;

	/**
	 * @param id
	 */
	public Developer(String id) {
		super();
		this.id = id;
	}

	/**
	 * @param id
	 * @param name
	 * @param website
	 */
	public Developer(String id, String name, String website) {
		super();
		this.id = id;
		this.name = name;
		this.website = website;
	}

	public Element convertToXmlElement() {
		Element result = new Element(XmlTags.TAG_DEVELOPER);

		result.setAttribute(XmlTags.TAG_DEVELOPER_ATTRIBUTE_ID, this.getId());

		Element element;

		element = new Element(XmlTags.TAG_DEVELOPER_TAG_NAME);
		element.setText(this.getName());
		result.addContent(element);

		element = new Element(XmlTags.TAG_DEVELOPER_TAG_WEBSITE);
		element.setText(this.getWebsite());
		result.addContent(element);

		return result;
	}

	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(String id) {
		if (id != null) {
			this.id = id;
		} else {
			this.id = "";
		}
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		if (name != null) {
			this.name = name;
		} else {
			this.name = "";
		}
	}

	/**
	 * @return the website
	 */
	public String getWebsite() {
		return website;
	}

	/**
	 * @param website
	 *            the website to set
	 */
	public void setWebsite(String website) {
		if (website != null) {
			this.website = website;
		} else {
			this.website = "";
		}
	}

}
